package cate.common.table.activity.rebate.sheet;

import cate.common.table.ESheet;
import cate.common.table.activity.rebate.row.RebateBaseRow;

import java.util.List;
import java.util.stream.Collectors;

public class RebateBaseSheet extends ESheet<RebateBaseRow> {
    @Override
    public String getSheetName() {
        return "积天豪礼基础";
    }

    public List<RebateBaseRow> getRowsByDay(int day) {
        return getList().stream().filter(row -> row.startDay <= day && row.endDay >= day).collect(Collectors.toList());
    }

    public RebateBaseRow getRowByDayAndMoney(int day, long money) {
        return getList().stream().filter(row -> row.startDay <= day && row.endDay >= day && row.amount == money).findAny().orElse(null);
    }
    public RebateBaseRow getRowByGroup(int group) {
        return getList().stream().filter(row ->row.group == group).findAny().orElse(null);
    }
}
